<%-- 
    Document   : index
    Created on : 22/05/2010, 14:34:41
    Author     : leoomoreira
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="icon" href="images/tux.png" type="image/x-icon">
        <link rel="shortcut icon" href="images/tux.png" type="image/x-icon">           
        <title>Fullalbum</title>
        <script type="text/javascript" src="js/login.js"></script>
        <style type="text/css">
            <!--
            body {
                font-family: Arial, Helvetica, sans-serif;
                font-size: 12px;
                color: #444444;
                text-decoration: none;
            }
            .message {
                color: #FF0000;
                text-align: center;
            }
            .title {
                color: #000000;
                font-weight: bold;
                text-align: center;
            }
            select {
                font: 12px Arial, Helvetica, sans-serif;
                color: #444444;
            }
            input {
                font: 12px Arial, Helvetica, sans-serif;
                color: #444444;
            }
            .systemDetection {
                padding: 2px;
                border: 1px solid #444444;
                width: 300px;
            }
            -->
        </style>
    </head>
    <body>
        <center>
            <form action="LoginServlet" method="post">
                <table>
                    <tr>
                        <td><img src="images/tux.png" border="0" /></td>
                        <td><span class="title">Fullalbum v.0.1 Beta</span></td>
                    </tr>
                </table>
                <br/>
                <table>
                    <tr>
                        <td><fmt:message key="index.login"/>:</td>
                        <td><input type="text" id="login" name="login" value="<%= (request.getAttribute("login") != null) ? request.getAttribute("login").toString() : ""%>" /></td>
                    </tr>
                    <tr>
                        <td><fmt:message key="index.password"/>:</td>
                        <td><input type="password" id="password" name="password" /></td>
                    </tr>
                    <% if (request.getAttribute("message") != null) {%>
                    <tr>
                        <td colspan="2" class="message">
                        <b>
                            <% if (request.getAttribute("message").toString().equals("messages.login.unablelogin")) { %>
                            <fmt:message key="messages.login.unablelogin"/>
                            <% } %>
                            <% if (request.getAttribute("message").toString().equals("messages.login.sessionended")) { %>
                            <fmt:message key="messages.login.sessionended"/>
                            <% } %>
                        </b>
                        </td>
                    </tr>
                    <% }%>
                    <tr>
                        <td colspan="2" align="center"><input type="submit" id="submitLogin" value="Sign in" /></td>
                    </tr>
                </table>
                <br/>
                <table>
                    <tr>
                        <td><img src="images/date.png" /></td>
                        <td><fmt:message key="index.lastupdate"/>: 06/11/2010</td>
                    </tr>
                </table>
                <br/>
                <div id="detectionResults" class="systemDetection"></div>
                <br />
                <div>
                    <a href="ChangeLocaleServlet?language=pt&url=<%= request.getRequestURL() %>"><img src="images/br.gif" border="0" /></a>&nbsp;
                    <a href="ChangeLocaleServlet?language=us&url=<%= request.getRequestURL() %>"><img src="images/us.gif" border="0" /></a>
                </div>
            </form>
        </center>
    </body>
</html>
<script language="JavaScript">
    <% if (request.getAttribute("login") != null) {%>
        document.getElementById("password").focus();
    <% } else {%>
        document.getElementById("login").focus();
    <% }%>
    function getInfo(){
        document.getElementById("detectionResults").innerHTML+= '<b><fmt:message key="index.system.title"/></b><br/><br/>';
        document.getElementById("detectionResults").innerHTML+= '<fmt:message key="index.system.os"/>: <b>' + getOSName() + '</b><br/>';
        document.getElementById("detectionResults").innerHTML+= '<fmt:message key="index.system.browsername"/>: <b>' + getBrowserName() + '</b><br/>';
        document.getElementById("detectionResults").innerHTML+= '<fmt:message key="index.system.browserversion"/>: <b>' + getBrowserVersion() + '</b><br/>';
        document.getElementById("detectionResults").innerHTML+= '<fmt:message key="index.system.screensize"/>: <b>' + getScreenSize() + '</b><br/>';
    }
    getInfo();
    if (getBrowserName() == 'Internet Explorer' && getBrowserVersion() < 7) {
        document.getElementById('login').disabled = true;
        document.getElementById('password').disabled = true;
        document.getElementById('submitLogin').disabled = true;

        var firefoxBegin = '<a href="http://www.getfirefox.com/">';
        var firefoxEnd = '</a>';

        var message = '<table><tr><td style="color: #ff0000;">Your browser is outdated, install the </td><td>' + firefoxBegin + '<img src="images/firefox.png" border="0" />' + firefoxEnd + '</td><td> ' + firefoxBegin + 'Firefox' + firefoxEnd + '</td></tr></table>'
        document.getElementById('detectionResults').innerHTML += '<br/>' + message;
    }
</script>